package com.syh.feignapi.clients;

import com.syh.bscommon.pojo.Transactions;
import com.syh.feignapi.clients.fallback.CreditsClientFallback;
import com.syh.feignapi.pojo.CarbonCredits;
import com.syh.feignapi.pojo.Result;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * @author syh 86187
 * @date 2024/7/16
 * com.syh.feignapi.clients
 * @description
 */
@FeignClient(value = "credits-service", fallbackFactory = CreditsClientFallback.class)//指定调用哪个服务
public interface CreditsClient {
    @PostMapping("/carbon-credits/setinfo")
    Result setinfo(@RequestBody CarbonCredits carbonCredits);

    @GetMapping("/carbon-credits/getCreditAmount_f")
    BigDecimal getCreditAmount(@RequestParam Integer companyId);

    @PutMapping("/carbon-credits/updateCreditAmount")
    void updateCreditAmount(@RequestParam Integer companyId, @RequestParam BigDecimal emissionAmount);
    @PutMapping("/carbon-credits/updateCreditAmountAdd")
     void updateCreditAmountAdd(@RequestParam Integer companyId, @RequestParam BigDecimal emissionAmount);

    @GetMapping("/carbon-credits/getAccount")
    Result getAccount(@RequestParam Integer companyId);


    @PutMapping("/carbon-credits/updateAccount_a")
    @Operation(summary = "feign更新卖家公司余额+")
     void updateAccount_a(@RequestBody Transactions transactions);
    @PutMapping("/carbon-credits/updateAccount_s")
    @Operation(summary = "feign更新买家公司余额-")
     void updateAccount_s(@RequestBody Transactions transactions);
    @PutMapping("/carbon-credits/updateAccount_add_buy")
    @Operation(summary = "feign更新买家公司余额退款+")
     void updateAccount_add_buy(@RequestBody Transactions transactions);
    @PutMapping("/carbon-credits/updateAccount_add_sell")
    @Operation(summary = "feign更新买家公司余额退款-")
     void updateAccount_add_sell(@RequestBody Transactions transactions);
}
